<template>
  <div class="app-container">
    <div v-if="user">
      <el-row :gutter="20">

        <el-col :span="12" :xs="24">
          <user-card :user="user" />
        </el-col>

        <el-col :span="12" :xs="24">
          <el-card>
            <el-tabs v-model="activeTab">
<!--              <el-tab-pane label="Activity" name="activity">-->
<!--                <activity />-->

<!--              </el-tab-pane>-->
              <el-tab-pane label="Information Change" name="Information Change">
                <intro-change @refresh-intro="getUser" :user="user" />
              </el-tab-pane>
              <el-tab-pane label="Introduction Change" name="Introduction Change">
                <change-profile-m-d />
              </el-tab-pane>
              <el-tab-pane label="Password Change" name="Password Change">
                <password-change :user="user" />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>


      </el-row>
    </div>
  </div>
</template>

<script>

import UserCard from './components/UserCard'
import Activity from './components/Activity'
import IntroChange from './components/IntroChange'
import {userGet} from "@/api/user";
import Experience from "@/views/profile/components/experience";
import PasswordChange from "@/views/profile/components/PasswordChange";
import ChangeProfileMD from "@/views/profile/components/changeProfileMD";

export default {
  name: 'Profile',
  components: {ChangeProfileMD, PasswordChange, Experience, UserCard, Activity, IntroChange },
  data() {
    return {
      user: {},
      activeTab: 'Information Change'
    }
  },
  computed: {
    // ...mapGetters([
    //   'name',
    //   'avatar',
    // ])
  },
  created() {
    this.getUser()
  },
  methods: {
    getUser() {
      userGet('1').then(res => {
        // this.user = res.data
        // this.user.userSkill = JSON.parse(res.data.userSkill)
        // console.log(this.user)
        let data = res.data;
        this.user = {
          userId: data.userId,
          userLoginName: data.userLoginName,
          userNickname: data.userNickname,
          userEmail: data.userEmail,
          userPhone: data.userPhone,
          userAvatar: data.userAvatar,
          userPassword: '',
          userStatus: data.userStatus,
          userLoginIp: data.userLoginIp,
          userLoginDate: data.userLoginDate,
          userPwdUpdateDate: data.userPwdUpdateDate,
          userInfoUpdateTime: data.userPwdUpdateDate,
          userSkill: JSON.parse(data.userSkill)
        }
      })
    }
  }
}
</script>
